import { useNavigate, useParams } from 'react-router-dom'


const Detail1 = ()=>{
    const navigate = useNavigate()
    const params = useParams()

    const goBack = ()=>{
        navigate(-1)  //this.history.go(-1)
    }

    return(<>
    <div>详情页面2</div>
    <div>
    <div>收到上一个页面的数据 params = { JSON.stringify(params) }</div>
        <button onClick={goBack}>点我返回到首页</button>
    </div>
    </>)
}

export default Detail1